import React from 'react'
class Test extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      islogin: false,
    }
  }
  modifyClick = () => {
    this.setState({
      islogin: !this.state.islogin,
    })
  }
  render() {
    const { islogin } = this.state
    return (
      <>
        <button onClick={() => this.modifyClick()}>切换</button>
        <hr />
        {islogin || (
          <span id='parentdiv' style={{ width: '400px', height: '400px', backgroundColor: '#891029', textAlign: 'center' }}>
            Test1
          </span>
        )}
        <span id='parentdiv' style={{ width: '400px', height: '400px', backgroundColor: '#182790', textAlign: 'center', display: islogin ? 'inline' : 'none' }}>
          Test2
        </span>
      </>
    )
  }
}

export default Test
